﻿using FullApp1.Core;
using FullApp1.Modules.ModuleName.Views;
using Prism.Ioc;
using Prism.Modularity;
using Prism.Regions;
using System.Windows;
using System;

namespace FullApp1.Modules.ModuleName
{
    public class ModuleNameModule : IModule
    {
        private readonly IRegionManager _regionManager;

        public ModuleNameModule(IRegionManager regionManager)
        {
            _regionManager = regionManager;
        }

        public void OnInitialized(IContainerProvider containerProvider)
        {
            //_regionManager.RequestNavigate(RegionNames.ContentRegion, "ExistingPage");
            _regionManager.RequestNavigate(RegionNames.ContentRegion, "LicenseDetail");
        }

        public void RegisterTypes(IContainerRegistry containerRegistry)
        {
            // 注册主题资源
            var resourceDict = new ResourceDictionary
            {
                Source = new Uri("/FullApp1.Modules.ModuleName;component/Themes/ModuleNameTheme.xaml", UriKind.Relative)
            };
            Application.Current.Resources.MergedDictionaries.Add(resourceDict);
            // 注册视图导航
            //containerRegistry.RegisterSingleton<IExportService, ExportService>();
            containerRegistry.RegisterForNavigation<ExistingPageView>();
            containerRegistry.RegisterForNavigation<LicenseDetailView>();
            // 注册对话框
            containerRegistry.RegisterDialog<OperatorDetailDialog, OperatorDetailDialogModel>();
        }
    }
}